package cn.endeavour.basic.util;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 封装增删改的结果
 */
@Data
@NoArgsConstructor
public class AjaxResult {

	/** 是否成功 */
	private Boolean success = true;

	/** 提示消息 */
	private String msg = "操作成功";

	/** 数据 */
	private Object resultObj;

	public AjaxResult(Boolean success, String msg) {
		this.success = success;
		this.msg = msg;
	}

	/**
	 * 成功不携带数据返回
	 * @return
	 */
	public static AjaxResult me(){
		AjaxResult ajaxResult = new AjaxResult();
		return ajaxResult;
	}

	public AjaxResult setSuccess(Boolean success) {
		this.success = success;
		return this;
	}

	public AjaxResult setMsg(String msg) {
		this.msg = msg;
		return this;
	}

	public AjaxResult setResultObj(Object resultObj) {
		this.resultObj = resultObj;
		return this;
	}

}
